let myArr = ['王一', '李二', '刘三']

myArr.forEach((item, index, arr) => {
    console.log("item:" + item);
    console.log('index:' + index);
    console.log('arr:' + JSON.stringify(arr));
})

// 无法改变原数组
let numArr = [1, 2, 3];
numArr.forEach((item) => {
    item = item * 2;
})
console.log(numArr);  // [1, 2, 3]

// 直接修改整个元素对象时，无法改变原数组
let objArr = [
    { name: '老六', age: 20 },
    { name: '憨憨', age: 18 }
];

objArr.forEach((item) => {
    item = {
        name: '土狗',
        age: '19'
    }
})
console.log(JSON.stringify(objArr));